home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TOOLKI.ARJ / DOCS < prev    next >
Text File  |  1991-01-07  |  19KB  |  367 lines

  1. Hit zoom window!
  2.                              OAT BRAN SOFTWARE
  3.                         Documentation for TOOLS.PRG
  4.                                                                 Brian Jepson
  5.                                                                     01/07/91
  6. ALSO find files:
  7. TOOLS.PRG                - source code
  8. TOOLS.FXP                - FoxPro `compiled' code
  9. ODOMETER.DBF            - for ODOMETER()
  10. CONCHECK.DBF            - for CARD()
  11. REGISTER.DBF            - for SYSTEMMENU
  12. REGISTER.FPT            - memo fields for REGISTER
  13.  
  14.                                Introduction:
  15.  
  16.     If you don't have FoxPro, this might not be of much use to you. If you're interested in what you see here, though, for a small price ($10), we could make available a demo oriented towards programmers which demonstrate the syntax and execution of these files. The price you are paying will cover our production costs as well as the cost of the FoxPro run-time package which will come with it.
  17.     This is strictly for programmers only. You will not enjoy this if you aren't a programmer. What's a programmer? You might be one. It's entirely possible. Maybe it's safe to say that you are one if you enjoy this.
  18.  
  19.                           The Oat Bran Challenge:
  20.     You will notice that some of the documentation mentions features that I would have liked to put in the program, but couldn't- for reasons of priority, mostly. If you feel up to it, add these features yourself. Feel free to fix bugs or add any features that you feel are appropriate. But for Gawd's sake, let me know of any changes you make so I can keep up with them! If you cannot contact us through COMPUSERVE (70020,760), do so at the following address or phone number:
  21.  
  22.                                                Memorial Union Systems Office
  23.                                                        50 Lower College Road
  24.                                                           Kingston, RI 02881
  25.                                                               (401) 792-4019
  26.  
  27.  
  28. Here goes...
  29. Parsing Functions:
  30.                                                                                                                                                                               
  31. FIRST(<expC>)
  32. BUTFIRST(<expC>)
  33. TAIL(<expC>)
  34. ITEM(<expC>,<expN>)
  35. ATOMS(<expC>)
  36.  
  37.     FIRST(), BUTFIRST() and TAIL() perform similar functions. When <expC> is a list containing at least one member, FIRST() will return the first member of that list; BUTFIRST() will return all members but the first of that list; and TAIL() will return the last member of that list. The AT() and RAT() functions let us speedily locate the first and last space found in the list.
  38.     ITEM() requires two parameters. <expC> should be the name of a list, and <expN> should be the number of the list member you wish to obtain. ITEM() then returns that member. By performing a BUTFIRST() on the list, we cycle through the list for <expN>-1 iterations. At this point, we have a list which begins with the atom we wish to seek. Now, it's a matter of applying FIRST() to that list to get the desired atom. 
  39.     ATOMS() returns the number of members in a list, where <expC> is a list. This operation performs BUTFIRST() over and over on the list and returns the number of BUTFIRST() it was able to perform before BUTFIRST() returned the empty set.
  40.  
  41.  
  42. Other Functions:
  43.  
  44.  
  45. DEPTH(<expC>,<expN>)
  46.  
  47.     DEPTH() permits you to determine the depth of a memory variable array, provided that it is organized such that non-empty array elements are low numbered and contiguous and that the empty elements are high numbered and contiguous. The name of the array is passed in <expC> and the size to which it was DIMENSIONed is passed in <expN>. DEPTH() then returns the number of elements which are not empty. The process is similar to ATOMS() in that DEPTH() cycles through the array until it finds an empty array element. This function is almost exclusively used by ODOMETER(). Since the array ODOMETER accesses is public, the jurisdiction of ODOMETER() can often be trampled upon using this function.
  48.  
  49.  
  50. MILITARY(<expC>)
  51.  
  52.     MILITARY() takes a string variable which conforms to a picture definition "99:99XX" such as " 4:45pm", "10:30am" and returns a four-digit military or 24-hour format time. The conversion algorithm explains itself. Take a look at the source code!
  53.  
  54.  
  55.  
  56. Odometer functions:
  57.     Technical notes for this function are really beyond the scope of this documentation. Fortunately, the source code is quite well documented. So, READ IT!
  58.  
  59. ODOMETER("setup",<expC>,"at",<expN1>,<expN2>,"max",<expN3>,"length",<expN4>)
  60.  
  61. <expC> : The name of an array.
  62. <expN1>: Row at which the odometer will be displayed.
  63. <expN2>: Column at which the odometer will be displayed.
  64. <expN3>: Maximum number of entries in the named array.
  65. <expN4>: Desired length of an array element.
  66.  
  67.     This use of odometer sets up the odometer on the screen. An odometer is a method of allowing the input screen to modify large arrays without having to have the whole array on the screen. By rolling up or down through the array, the user can selectively modify array elements. The function call returns a numeric variable containing the handle number.
  68.  
  69.  
  70. ODOMETER("roll","up",<expN>)
  71. ODOMETER("roll","down",<expN>)
  72.  
  73. <expN> : Handle of odometer to roll.
  74.  
  75.     Rolling up or down moves the odometer pointer and display to the next or previous element in the array. If an attempt is made to pass the maximum depth or lowest element, an alarm is sounded.
  76.  
  77.  
  78. ODOMETER("add",<expN>)
  79.  
  80. <expN> : Handle of odometer to add entry to.
  81.  
  82.     Adds a new element to the array and allows the user to edit the element.
  83.  
  84.  
  85. ODOMETER("menu",<expN>)
  86.  
  87. <expN> : Handle of odometer to create menu from.
  88.  
  89.     All elements in the array are combined into a popup menu. This is useful for seeing all the elements at once and/or selecting one from the list. After an item is selected from the menu, the odometer pointer is updated to that element and the display is updated accordingly.
  90.  
  91.  
  92. ODOMETER("edit",<expN>)
  93.  
  94. <expN> : Handle of odometer to edit.
  95.  
  96.     Allows the user to edit whichever array element is currently displayed.
  97.  
  98.  
  99. ODOMETER("close",<expN>)
  100.  
  101. <expN> : Handle of odometer to close.
  102.  
  103.     Closes the specified odometer and performs all necessary housekeeping tasks. It is IMPERATIVE that any opened odometer be closed.
  104.  
  105.  
  106. ODOMETER("delete",<expN>)
  107.  
  108. <expN> : Handle of odometer to delete an element from.
  109.  
  110.     Deletes the currently displayed element.
  111.  
  112.  
  113. ODOMETER("refresh",<expN>)
  114.  
  115. <expN> : Handle of the odometer to refresh.
  116.  
  117.     In case anything has happened to the screen display, this command will redraw the odometer display.
  118.  
  119.  
  120. ODOMETER() notes...
  121.  
  122. ODOMETER() uses work area I to open a database called odometer.
  123.  
  124. ODOMETER() procedures:
  125.  
  126. menu                Processes request for a menu and makes it.
  127. refreshHandle        Processes request for a refresh and calls refreshOd.
  128. setOd                Processes setup request and sets up an odometer.
  129. refreshOd            Refreshes the current array element.
  130. roll                Processes requests to roll up or down.
  131. edit                Processes request to edit.
  132. add                    Processes add request.
  133. del                    Processes delete request.
  134. close                Closes odometer and deletes dbf entries.
  135. fieldEdit            Edits current array element.
  136. fieldSay            Puts current array element into odometer window.
  137. getHandle            Locates handle within the dbf and retrieves handle data.
  138.  
  139.  
  140.  
  141. Some other functions and procedures...
  142.  
  143. ALERT(<expC1>, <expC2>, <expC3>, <expC4>, <expC5>, [<expC6, <expC7>])
  144.  
  145. <expC1> : The icon form that the alert takes. May be one of the following:
  146.     "dialogue", "wait", "unhappy", "happy", or "question"
  147.     
  148.     These icons are in TOOLS.PRG in a procedure called ikon. More may be added as the programmer sees fit. All that a programmer needs to do is add another case statement containing the necessary graphic description. At some point, icon data will be incorporated into the foxuser resource file.
  149.  
  150. <expC2 - expC4> : These are the three menu pads that accompany the alert box. If any of these are set to the value "null", they will not display. In this manner, the programmer can limit the number of menu bars which are used.
  151.  
  152. <expC5 - expC7> : The programmer may specify up to three lines of text which are part of the alert. These are displayed to the right of the icon and above the menu pads.
  153.  
  154.     ALERT() creates a window on the screen. In the window is displayed an icon, up to three lines of communication to the end user, and up to three pads of a menu to allow a user choice. The menu choice is returned as an integer- 1, 2, or 3 depending on which pad was selected. The value returned corresponds to the position of the pad. So if the first one is null, and the second and third are defined, selecting the first pad visible to the end user(i.e. the second) returns a value of two.
  155.  
  156. EXAMPLE:
  157. response = ALERT("dialogue", "Continue", "null", "Cancel", "Action?")
  158.  
  159.     The functioning of this is very straightforward. See the source code for details.
  160.  
  161. do EXPLODE with <expN1>, <expN2>, <expN3>, <expN4>, <expN5>, <expN6>
  162.  
  163. <expN1>: Starting x coordinate for window position.
  164. <expN2>: Starting y coordinate for window position. 
  165. <expN3>: Ending x coordinate for window position.
  166. <expN4>: Ending y coordinate for window position.
  167. <expN5>: Ending height of window.
  168. <expN6>: Ending width of window.
  169.  
  170.     The EXPLODE procedure creates an exploding box on the screen which begins as a very small window and increases until it has moved to the desired location and expanded to its desired size. Fancy, but not horribly useful as it is one more thing which the end user must sit tapping fingers for...
  171.  
  172.  
  173. do TEDIT with <expC>
  174.  
  175. <expC> : List expression.
  176.  
  177.     The list expression <expC> is composed of at least three atoms. The first is the NAME of a variable which is a string containing a title message. We will assume that there is a variable teditTitle, such that
  178.  
  179. teditTitle = "A tedit title message"
  180.  
  181. The second atom of the list expression should be either "center", "left", or "right". These refer to the justification within the window that the @...SAY/GET will take. Following this, the next atom should be the name of a variable containing a prompt string. Let's assume that there is a variable teditPrompt, such that
  182.  
  183. teditPrompt = "∞"
  184.  
  185. In the list expression, teditPrompt is followed by "|", the pipe symbol, and the NAME of the variable we wish to edit. Let's assume the name of that variable is "anyVariable" and that it is initialized to have a length of 5. This variable may already have a value, and it will appear in the @...SAY/GET. Following this, another pipe symbol should be inserted, followed by a picture string for the @...SAY/GET. TEDIT does not yet support picture strings containing spaces. This is due to the fact that the programmer has a lot more important stuff to deal with. Let's make the picture string "#,###".
  186.  
  187. If all this data were in a tedit command statement, it would look like this:
  188.  
  189. do TEDIT with "teditTitle center teditPrompt|anyVariable|#,###"
  190.  
  191. There may be any number of "teditPrompt|anyVariable|pictureString" clusters. This results in a vertical stacking of @...SAY/GETS. Theoretically, you can have as many of these as you want, but they might run off the bottom of the screen. TEDIT makes heavy use of macro substitution within variables, but this doesn't seem to slow down the program as much as one would expect.
  192.  
  193.  
  194. GETTIME(<expN1>, <expN2>)
  195.  
  196. <expN1>: Row at which to display the @...SAY/GET.
  197. <expN2>: Column at which to display the @...SAY/GET.
  198.  
  199. GETTIME(), with its subfunction TIMETEST, prompts for the user to input an am/pm format time, validating it through the above mentioned subfunction. This is just a basic @...SAY/GET routine, but one that could be used enough; it warrants being in my toolchest. MILITARY() is extemely nice in converting GETTIME() data to 24-hour format.
  200.  
  201.  
  202. TICK(<expN1>, <expN2>, <expC>)
  203.  
  204. Variables which must predate TICK():
  205.  
  206. mPrompts[<expN>]
  207.  
  208. <expN1>: Row at which popup is produced.
  209. <expN2>: Column at which popup is produced.
  210. <expC> : String equal in length to number of elements in mPrompts.
  211.  
  212. mPrompts[] is an array containing the prompts which will appear on the popup menu. The popup items are designed in such a way that when one is selected, the popup is redefined to have a check mark before the item. When that item is again selected, the check mark is removed. Each character in <expC> corresponds to a prompt in mPrompts[], so the programmer can process responses to selections in this manner. TICK() returns the value of <expC>, so supposing a name "spizzleGorp" for <expC>, a function call for TICK() should look like this in order for it to be useful:
  213.  
  214. spizzleGorp = TICK(10, 12, spizzleGorp)
  215.  
  216. Otherwise, <expC> is not changed after the user makes a selection. TICK() is useful for processing selections in which more than one item may be desired by the user.
  217.  
  218.  
  219. INRANGE(<expN1>, <expN2>, <expN3>, <expN4>)
  220.  
  221. <expN1 - expN2>: Starting and ending time of first range.
  222. <expN3 - expN4>: Starting and ending time of second range.
  223.  
  224. Returns .T. if the two time ranges overlap. All times should be in 24-hour format. MILITARY() (see above) will translate am/pm format to 24-hour if needed. Merely performs a mammoth BETWEEN() operation on all concerned parties.
  225.  
  226.  
  227. do CHOOSER
  228.  
  229. Needs global variable:
  230. chosenPrinter
  231.  
  232. Brings forward a dialogue which lets the end user select from available printers. Unfortunately, there is no facility at this time for determining available printers, so the data must be hard-coded into the software. In order to detect available printers, some external command must be employed.
  233.  
  234.  
  235. do OBJECTS
  236.  
  237. Defines menus and windows for use with CHOOSER.
  238.  
  239.  
  240. do PRINTSETUP
  241.  
  242. Based upon the chosen printer, cycles through font and style options for the printer in question. Not fully developed. Look at it, see what YOU think...
  243.  
  244.  
  245. do USERLIST
  246.  
  247. On a NOVELL network, as neatly as possible creates a window containing the names of all users currently on the network. Even when I try to pipe data away from the screen, this stupid "Writing data to output file..." message is generated. 
  248.  
  249.  
  250. do OPENPROGRAM with <expC>
  251.  
  252. <expC> : Program title.
  253.  
  254. Flashy intro for program execution. EXPLODEs a window and puts the program title at the top of the screen.
  255.  
  256.  
  257. do SYSTEMMENU
  258.  
  259. Activates the system menu and performs action based on the selection. System information and "desk accessories" should be put here. Here's what's in it so far:
  260.  
  261. About...
  262. Opens a dbf called REGISTER, which contains information about who the Oat Bran Product is registered to, and some data about the program. Puts the about data on screen in a window.
  263.  
  264. Help...
  265. Brings up the help window, what else?
  266.  
  267. Chooser...
  268. See "do CHOOSER" above.
  269.  
  270. Userlist...
  271. See "do USERLIST" above.
  272.  
  273.  
  274. do SHRINK with <expN1>, <expN2>, <expN3>, <expN4>, <expN5>, <expN6>
  275.  
  276. <expN1>: Starting x coordinate for window position.
  277. <expN2>: Starting y coordinate for window position. 
  278. <expN3>: Ending x coordinate for window position.
  279. <expN4>: Ending y coordinate for window position.
  280. <expN5>: Ending height of window.
  281. <expN6>: Ending width of window.
  282.  
  283. The opposite of EXPLODE (see above). Puts a bunch of shrinking windows on screen. Maybe we should have called it "IMPLODE."
  284.  
  285.  
  286. do DIVQ with <expC>, <expN>
  287.  
  288. <expC> : A block of text.
  289. <expN> : Desired length for lines that the text is divided into.
  290.  
  291. There might be one program left which uses this. DIVQ divides a block of text into up to two lines, displaying them in the upper left corner of the active window or screen. Don't use it; it's not very reliable when it comes to big words. I abandoned it, and I'm phasing it out as quickly as I can get a round tuit.
  292.  
  293.  
  294. do BEEPERROR
  295.  
  296. Someday, we're going to make an Oat Bran Control Panel, and this will serve a useful function. Right now, it's called when the user clicks where they're not supposed to. It flashes black across the top of the screen, like that other computer does when the beep volume is turned off.
  297.  
  298.  
  299. YO(<expC1>, <expN>, <expC2>, <expC3>, <expC4>)
  300.  
  301. <expC1>: Icon form (see ALERT())
  302. <expN> : Time in seconds that this message should stay on screen.
  303. <expC2>: First line of message text.
  304. <expC3>: Second line of message text.
  305. <expC4>: Third line of message text.
  306.  
  307. YO() puts an ALERT()-like window on the screen, but without user responses. It waits for <expN> seconds or until the user presses a key. A little better than using the WAIT command.
  308.  
  309.  
  310. Card functions...
  311. Take a look at the source code, try to understand it.
  312.  
  313. CARD("setup <expC>")
  314.  
  315. <expC> : The name of a database which describes the card which the programmer wishes to have active.
  316.  
  317. This function call to card sets up the card on the screen. A card is a group of buttons. Buttons are similar to menus, except that they may be more easily deactivated, they are more flexibly defined, and double-clicks are more easily processed. The defining database contains the following fields:
  318.  
  319. ROW            Row at which the button will be displayed.
  320. COLUMN        Column at which the button will be displayed.
  321. BUTTON        Name of the button to display
  322.  
  323. CARD() verifies that the specified database is indeed a valid one. It then goes on to display the buttons on the screen. Control is then returned to the calling program.
  324.  
  325.  
  326. CARD("check [disabled]")
  327.  
  328. This call asks card to check the buttons onscreen for a click or a double-click. The value returned is the number of the button clicked. If it was a double-click, then the value returned is the number of the button clicked multiplied by -1. Double clicks may be ignored by employing the ABS() function. Including the "disabled" option will check even disabled buttons.
  329.  
  330.  
  331. CARD("disable <expN>")
  332. CARD("enable <expN>")
  333.  
  334. <expN> : Number of button to disable or enable.
  335.  
  336. Enables or disables a button for checking. Disabled buttons appear in gray.
  337.  
  338.  
  339. CARD("close")
  340.  
  341. Releases global variables initialized by CARD().
  342.  
  343.  
  344. CARD("refresh")
  345.  
  346. Refreshes the CARD() display. Useful when some external command has filled the screen with garbage. Useful even if one of the programmer's glitches has filled the screen with garbage. If you want to be sloppy, assign an on key label as such:
  347.  
  348. on key label alt+r    x = CARD("refresh")
  349.  
  350. IF you want to be sloppy. The best thing to do is not to screw up the display in the first place. But sometimes, when ESCAPEing from a program, the screen turns into spaghetti. So go ahead; BE SLOPPY!
  351.  
  352. Procedures:
  353.  
  354. doCard                    Looks for the database, then calls checkDataBase.
  355. checkDataBase            Examines the chosen database to determine whether
  356.                         or not it is a proper configuration database. Then
  357.                         it calls prepare and refresh.
  358. prepare                    Initializes button variables.
  359. check                    Processes mouse clicks.
  360. refresh                    (re)Draws the buttons.
  361. disable                    Processes requests to disable.
  362. enable                    Processes requests to enable.
  363. flash                    Flashes a button after it's been clicked on.
  364. sayAButton                Determines which color to display a button in.
  365.  
  366. PEACE.
  367.